﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SharpShare.Afp.Protocol.Security;
using System.Net;

namespace SharpShare.Afp {
    public sealed class AfpServerSettings {
        public const int DefaultRequestQuanta = 10485760;
        public const int DefaultWanRequestQuanta = 8192;
        public const int DefaultAfpPort = 548;
        public const string DefaultMachineType = "Xserve";
        public static readonly TimeSpan DefaultShutdownDelay = TimeSpan.FromSeconds(10);
        public static readonly IPAddress DefaultBinding = IPAddress.Any;

        public AfpServerSettings() {
            this.Port = DefaultAfpPort;
            this.MachineType = DefaultMachineType;
            this.ShutdownDelay = DefaultShutdownDelay;
            this.RequestQuanta = DefaultRequestQuanta;
            this.WanRequestQuanta = DefaultWanRequestQuanta;
            this.Binding = DefaultBinding;

            this.AuthenticationMethods = new List<IAfpUserAuthenticationMethod>();
            this.AuthenticationMethods.Add(new AfpDhx2UserAuthenticationMethod());
        }

        public int Port { get; set; }
        public IPAddress Binding { get; set; }
        public Guid ServerSignature { get; set; }
        public string MachineType { get; set; }
        public TimeSpan ShutdownDelay { get; set; }
        public int RequestQuanta { get; set; }
        public int WanRequestQuanta { get; set; }
        public Protocol.IAfpUserManager UserManager { get; set; }
        public IList<IAfpUserAuthenticationMethod> AuthenticationMethods { get; private set; }

        public AfpServerSettings Clone() {
            return (AfpServerSettings)this.MemberwiseClone();
        }
    }
}
